
/*
 * @Descripttion: 物料信息的表
 * @version:
 * @Author: zp
 * @Date: 2019-08-16 09:17:57
 * @LastEditors: cxguo
 * @LastEditTime: 2020-08-24 07:50:54
 */

export default {
  data () {
    return {
      columnsData: [
        { field: 'materialId', title: 'ID', fixed: 'left', width: 100 },
        { field: 'materialNumber', title: '物料编号', width: 100 },
        { field: 'specifications', title: '规格', width: 200 },
        { field: 'materialName', title: '物料名称', width: 160 },
        { field: 'brand', title: '品牌', width: 80 },
        // { field: 'materialTypeId', title: '物料类型id', width: 80 },
        { field: 'producer', title: '产地', width: 80 },
        // { field: 'unitMeasurementId', title: '计量单位id', width: 80 },
        // { field: 'supplierId', title: '供应商id', width: 80 },
        { field: 'supplierName', title: '供应商名称', width: 100 },
        { field: 'unitPrice', title: '用户单价', width: 80, show: false },
        { field: 'barCode', title: '条码', width: 80 },
        { field: 'salesPrice', title: '销售单价', width: 80 },
        { field: 'minStock', title: '最低库存', width: 80 },
        { field: 'procurementCycle', title: '采购周期', width: 80 },
        { field: 'weight', title: '重量', width: 80 },
        { field: 'color', title: '颜色', width: 80 },
        { field: 'goodsAllocation', title: '货位', width: 80 },
        { field: 'useTo', title: '用途', width: 80 },
        { field: 'figureNumber', title: '图号', width: 80 },
        { field: 'remarks', title: '备注', width: 80 },
      ],
      // table遮罩层
      tableLoading:false,
      // table数据
      tableData: [],
    }
  },
  methods: {
    btnGetStock (params) {
      this.currentRow = params.row
      this.dialogVisible = true
    },
    btnStockLog (params) {
      const { row } = params
      const { skuId, name } = row
      this.$router.push({
        name: 'StockLogList',
        query: { id: skuId, name }
      })
    },
    footerMethod ({ columns, data }) {
      let array = []
      if (data.length > 0) {
        array = [
          columns.map((column, columnIndex) => {
            if (columnIndex === 0) {
              return '合计'
            }
            const tableTotal = this.tableTotal || {}
            return tableTotal[column.property]
          })
        ]
        return array
      }
      return []
    },
    onCellDblClick ({ row }) {
      // this.$emit('on-to-detail', row)
      console.log("onCellDblClick",row);
    },
  }
}

